Skip to content

Conversation

@eofff
Copy link
Contributor

@eofff eofff commented Jan 27, 2026

Description

Refactored VMOP Restore/Clone Controller

This PR refactors the VirtualMachineOperation controller for restore and clone operations. The implementation now uses a unified step-based execution flow, improving code maintainability and consistency between restore and clone operations.

Condition Changes

The RestoreCompleted and CloneCompleted conditions have been deprecated and removed. Both operations now use the unified Completed condition with appropriate reasons (ReasonRestoreInProgress, ReasonCloneInProgress, ReasonOperationCompleted, ReasonOperationFailed) to track operation progress and completion status.

Testing

Unit tests have been added to cover the refactored restore and clone step implementations.

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.
section: vmop
type: chore
summary: Remove CloneCompleted and RestoreComplete conditions. Refactoring.

@eofff eofff force-pushed the chore/vmop/remove-restore-clone-complete-condition branch from 7bfa8e2 to fac98f5 Compare January 27, 2026 09:42
@eofff eofff changed the title Chore/vmop/remove restore clone complete condition chore(vmop): refactoring vmop restore/clone Jan 28, 2026
@eofff eofff added this to the v1.5.0 milestone Jan 28, 2026
@eofff eofff marked this pull request as ready for review January 28, 2026 07:16
@eofff eofff requested a review from danilrwx January 28, 2026 07:16
@eofff eofff requested a review from danilrwx January 28, 2026 08:16
danilrwx
danilrwx previously approved these changes Jan 28, 2026
@eofff eofff marked this pull request as draft January 29, 2026 07:38
@eofff eofff force-pushed the chore/vmop/remove-restore-clone-complete-condition branch 3 times, most recently from 7995d93 to 8d47ebc Compare January 29, 2026 08:36
Valeriy Khorunzhin added 2 commits January 29, 2026 11:39
Signed-off-by: Valeriy Khorunzhin <[email protected]>

refactoring

Signed-off-by: Valeriy Khorunzhin <[email protected]>

fix

Signed-off-by: Valeriy Khorunzhin <[email protected]>

remove printf

Signed-off-by: Valeriy Khorunzhin <[email protected]>

fix e2e

Signed-off-by: Valeriy Khorunzhin <[email protected]>

total rewriting

Signed-off-by: Valeriy Khorunzhin <[email protected]>

fixes

Signed-off-by: Valeriy Khorunzhin <[email protected]>

tests

Signed-off-by: Valeriy Khorunzhin <[email protected]>

fix linter

Signed-off-by: Valeriy Khorunzhin <[email protected]>

fix linter 2

Signed-off-by: Valeriy Khorunzhin <[email protected]>

final -> completed

Signed-off-by: Valeriy Khorunzhin <[email protected]>

resolve

Signed-off-by: Valeriy Khorunzhin <[email protected]>
Signed-off-by: Valeriy Khorunzhin <[email protected]>
@eofff eofff force-pushed the chore/vmop/remove-restore-clone-complete-condition branch from 8d47ebc to 0bf2045 Compare January 29, 2026 08:39
@eofff eofff marked this pull request as ready for review January 29, 2026 09:01
@eofff eofff requested a review from danilrwx January 29, 2026 09:02
// Run execute until the operation is completed.
if svcOp.IsInProgress() {
return h.execute(ctx, vmop, svcOp)
if _, found := conditions.GetCondition(vmopcondition.TypeCompleted, vmop.Status.Conditions); found {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to comment, it should be !found or at least Status should be checked. Or change comment for more clarification.

Comment on lines +76 to +77
Expect(phase1).To(Equal(phase2))
Expect(phase2).To(Equal(phase3))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These asserts may generate unexpected results if phase in Equal 2 is not "Completed":

Something like "Test failed, expect Failed, got Completed"

Valeriy Khorunzhin added 3 commits January 29, 2026 18:37
Signed-off-by: Valeriy Khorunzhin <[email protected]>
Signed-off-by: Valeriy Khorunzhin <[email protected]>
Signed-off-by: Valeriy Khorunzhin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants